<?php
/*
 * Created on Jul 13, 2009
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
?>
<?php

class Model_experience extends Model {
	var $_tbl_name;

	function Model_experience() {
		// Call the Model constructor
		parent :: Model();
		$this->_tbl_name = "art_experience";
	}

	function find_by_nodeid($node_id){
		$sql = "SELECT * FROM {$this->_tbl_name} WHERE a_node_id='$node_id' order by a_sort ASC";
		$query = $this->db->query($sql);

		if ($query->num_rows() > 0) {
			$result = $query->result_array();
			return $result;
		}
		return null;
	}

	function find($id)
	{
		$sql = "SELECT * FROM {$this->_tbl_name} WHERE a_id='$id' order by a_sort ASC";
		$query = $this->db->query($sql);

		if ($query->num_rows() > 0) {
			$result = $query->first_row('array');
			$result['a_lead'] = stripcslashes($result['a_lead']);
			$result['a_mess_note'] = stripcslashes($result['a_mess_note']);
			$result['a_mess'] = stripcslashes($result['a_mess']);

			return $result;
		}
		return null;
	}

	function browse_tour_parentnode()
	{
		$sql = "SELECT nav.sid, atour.a_id, atour.a_node_id, atour.a_name FROM {$this->_tbl_name} AS atour INNER JOIN tbl_nav AS nav on atour.a_node_id = nav.id";
		$query = $this->db->query($sql);

		if ($query->num_rows() > 0) {
			return $query->result_array();
		}
		return null;
	}

}
?>